package client;

import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.SwingConstants;

public class OpponentPanel extends JPanel {

	int id;
	String nick;
	
	int playersBalance;
	int playersBet;
	
	JLabel lblNick;
	JLabel lblID;

	JLabel lblBet;
	JLabel lblBalance;
	private JLabel lblBetInfo;
	private JLabel lblBalanceInfo;
	
	
	/**
	 * Create the panel.
	 */
	public OpponentPanel() {
		super();
		setLayout(null);
		
		lblID = new JLabel("-");
		lblID.setHorizontalAlignment(SwingConstants.CENTER);
		lblID.setBounds(10, 32, 115, 14);
		lblID.setVerticalAlignment(SwingConstants.BOTTOM);
		lblID.setFont(new Font("Dialog", Font.PLAIN, 10));
		add(lblID);
		
		lblNick = new JLabel("-");
		lblNick.setHorizontalAlignment(SwingConstants.CENTER);
		lblNick.setBounds(10, 11, 115, 21);
		lblNick.setFont(new Font("Dialog", Font.BOLD, 16));
		add(lblNick);
		
		lblBetInfo = new JLabel("bet");
		lblBetInfo.setHorizontalAlignment(SwingConstants.CENTER);
		lblBetInfo.setFont(new Font("Dialog", Font.PLAIN, 10));
		lblBetInfo.setBounds(10, 103, 58, 14);
		add(lblBetInfo);
		
		lblBalanceInfo = new JLabel("balance");
		lblBalanceInfo.setHorizontalAlignment(SwingConstants.CENTER);
		lblBalanceInfo.setFont(new Font("Dialog", Font.PLAIN, 10));
		lblBalanceInfo.setEnabled(true);
		lblBalanceInfo.setBounds(67, 103, 58, 14);
		add(lblBalanceInfo);
		
		lblBet = new JLabel("-");
		lblBet.setFont(new Font("Dialog", Font.BOLD, 16));
		lblBet.setHorizontalAlignment(SwingConstants.CENTER);
		lblBet.setBounds(10, 114, 58, 45);
		add(lblBet);
		
		lblBalance = new JLabel("-");
		lblBalance.setHorizontalAlignment(SwingConstants.CENTER);
		lblBalance.setFont(new Font("Dialog", Font.BOLD, 16));
		lblBalance.setBounds(66, 114, 58, 45);
		add(lblBalance);
	}

	public void setLabelID(int ID) {
		lblID.setText(ID+"");
	}
	
	public void setLabelNick(String nick) {
		lblNick.setText(nick);
	}
	
	private void setLabelBet(int value) {
		playersBet = value;
		lblBet.setText(value+"");
	}
	
	private void setLabelBalance(int value) {
		playersBalance = value;
		lblBalance.setText(value+"");
	}
	
	public void updateLabels(int bet, int balance) {
		setLabelBet(bet);
		setLabelBalance(balance);
	}
	
	public void resetPanel() {
		lblID.setText("-");
		lblNick.setText("-");
	}
}
